<template>
  <div>
    首页
    <h1>{{ $t('xxx') }}</h1>
    <el-button @click="btnClick">切换</el-button>
  </div>
</template>
<script>
import jsCookie from 'js-cookie'
export default {
  methods: {
    btnClick() {
      if (this.$i18n.locale === 'en') {
        this.$i18n.locale = 'zh'
      } else {
        this.$i18n.locale = 'en'
      }
      jsCookie.set('lang', this.$i18n.locale)
      this.$router.go(0)
    }
  }
}
</script>
<style></style>
